package com.Test;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;

public class Test30 {
    public static void main(String[] args) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

        LocalDate today = LocalDate.now();

        // 获取当月的第一天
        LocalDate startOfMonth = today.with(TemporalAdjusters.firstDayOfMonth());

        // 获取当月的最后一天
        LocalDate endOfMonth = today.with(TemporalAdjusters.lastDayOfMonth());

        // 转换为字符串
        String startOfMonthStr = startOfMonth.format(formatter);
        String endOfMonthStr = endOfMonth.format(formatter);

        System.out.println("Start of Month: " + startOfMonthStr);
        System.out.println("End of Month: " + endOfMonthStr);
    }
}
